<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Dynamically constructs a new C array type</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="ffi.alignof.html">« FFI::alignof</a></li>
      <li style="float: right;"><a href="ffi.cast.html">FFI::cast »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="class.ffi.html">FFI</a></li>
    <li>Dynamically constructs a new C array type</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="ffi.arraytype" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">FFI::arrayType</h1>
  <p class="verinfo">(PHP 7 &gt;= 7.4.0, PHP 8)</p><p class="refpurpose"><span class="refname">FFI::arrayType</span> &mdash; <span class="dc-title">Dynamically constructs a new C array type</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-ffi.arraytype-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="modifier">static</span> <span class="methodname"><strong>FFI::arrayType</strong></span>(<span class="methodparam"><span class="type"><a href="class.ffi-ctype.html" class="type FFI\CType">FFI\CType</a></span> <code class="parameter">$type</code></span>, <span class="methodparam"><span class="type">array</span> <code class="parameter">$dimensions</code></span>): <span class="type"><a href="class.ffi-ctype.html" class="type FFI\CType">FFI\CType</a></span></div>

  <p class="para rdfs-comment">
   Dynamically constructs a new C array type with elements of type defined by <code class="parameter">type</code>,
   and dimensions specified by <code class="parameter">dimensions</code>. In the following example <code class="code">$t1</code>
   and <code class="code">$t2</code> are equivalent array types:
   <div class="informalexample">
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$t1&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">FFI</span><span style="color: #007700">::</span><span style="color: #0000BB">type</span><span style="color: #007700">(</span><span style="color: #DD0000">"int[2][3]"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$t2&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">FFI</span><span style="color: #007700">::</span><span style="color: #0000BB">arrayType</span><span style="color: #007700">(</span><span style="color: #0000BB">FFI</span><span style="color: #007700">::</span><span style="color: #0000BB">type</span><span style="color: #007700">(</span><span style="color: #DD0000">"int"</span><span style="color: #007700">),&nbsp;[</span><span style="color: #0000BB">2</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">3</span><span style="color: #007700">]);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-ffi.arraytype-parameters">
  <h3 class="title">参数</h3>
  <dl>
   
    <dt>
<code class="parameter">type</code></dt>

    <dd>

     <p class="para">
      A valid C declaration as <span class="type">string</span>, or an instance of <span class="classname"><a href="class.ffi-ctype.html" class="classname">FFI\CType</a></span>
      which has already been created.
     </p>
    </dd>

   
   
    <dt>
<code class="parameter">dimensions</code></dt>

    <dd>

     <p class="para">
      The dimensions of the type as <span class="type">array</span>.
     </p>
    </dd>

   
  </dl>

 </div>


 <div class="refsect1 returnvalues" id="refsect1-ffi.arraytype-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns the freshly created <span class="classname"><a href="class.ffi-ctype.html" class="classname">FFI\CType</a></span> object.
  </p>
 </div>


</div></div></div></body></html>